from langgraph.func import entrypoint,task
from langgraph.checkpoint.memory import MemorySaver

@task
def is_even(number:int) -> bool:
    return number % 2 == 0

@task
def multiply_by_two(number:int) -> int:
    return number * 2


@entrypoint(checkpointer=MemorySaver())
def number_workflow(input_number:int) -> int:
    if is_even(input_number).result():
        result = multiply_by_two(input_number).result()
        return result
    else:
        return input_number

config = {"configurable":{"thread_id":"workflow3"}}
print(number_workflow.invoke(4,config))
print(number_workflow.invoke(3,config))